package azku.entitys;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class EItemView {
	private int mItemID;
	private String mTitle;
	private int mPageCount;
	private int mGroupTypeID;
	private int mScore;
	private int mVindex;
	private int mVpower;
	private List<EItemAssess> mRetryMsg;
	private List<EItemViewChild> mImages;

	public EItemView() {
		mItemID = 0;
		mTitle = "";
		mPageCount = 0;
		mGroupTypeID = 0;
		mScore = 0;
		mVindex = 1;
		mVpower = 0;
		mRetryMsg = new ArrayList<EItemAssess>();
		mImages = new ArrayList<EItemViewChild>();
	}

	public EItemView(int itemid, String title, int grouptypeid, int score) {
		this();
		mItemID = itemid;
		mTitle = title;
		mGroupTypeID = grouptypeid;
		mScore = score;
	}

	public void setItemID(int itemid) {
		this.mItemID = itemid;
	}

	public int getItemID() {
		return this.mItemID;
	}

	public void setTitle(String title) {
		this.mTitle = title;
	}

	public String getTitle() {
		return this.mTitle;
	}

	public void setPageCount(int pagecount) {
		this.mPageCount = pagecount;
	}

	public int getPageCount() {
		return this.mPageCount;
	}

	public void setGroupTypeID(int grouptypeid) {
		this.mGroupTypeID = grouptypeid;
	}

	public int getGroupTypeID() {
		return this.mGroupTypeID;
	}

	public void setScore(int score) {
		this.mScore = score;
	}

	public int getScore() {
		return this.mScore;
	}

	public void setVindex(int ivindex) {
		mVindex = ivindex;
	}

	public int getVindex() {
		return this.mVindex;
	}

	public void setVpower(int ipower) {
		mVpower = ipower;
	}

	public int getVpower() {
		return this.mVpower;
	}

	public void setRetryAssess(List<EItemAssess> retrymsg) {
		this.mRetryMsg = retrymsg;
	}

	public List<EItemAssess> getRetryAssess() {
		return this.mRetryMsg;
	}

	public void setImages(List<EItemViewChild> images) {
		this.mImages = images;
	}

	public List<EItemViewChild> getImages() {
		return this.mImages;
	}

	public void bindParams(JSONArray obj) {
		if (obj == null)
			return;
		try {
			JSONArray jsonArr = obj.getJSONArray(0);
			if (jsonArr != null) {
				List<EItemViewChild> tempImages = new ArrayList<EItemViewChild>();
				for (int i = 0; i < jsonArr.length(); i++) {
					JSONObject childJSON = jsonArr.getJSONObject(i);
					if (childJSON != null) {
						EItemViewChild itemviewchild = new EItemViewChild();
						itemviewchild.bindParams(childJSON);
						tempImages.add(itemviewchild);
					}
				}
				this.setImages(tempImages);
			}
			jsonArr = obj.getJSONArray(1);
			if (jsonArr != null) {
				List<EItemAssess> tempAssess = new ArrayList<EItemAssess>();
				for (int i = 0; i < jsonArr.length(); i++) {
					JSONObject childJSON = jsonArr.getJSONObject(i);
					if (childJSON != null) {
						EItemAssess itemviewchild = new EItemAssess();
						itemviewchild.bindParams(childJSON);
						tempAssess.add(itemviewchild);
					}
				}
				this.setRetryAssess(tempAssess);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
	}
}
